home *** CD-ROM | disk | FTP | other *** search
/ Aminet 44 / Aminet 44 (2001)(GTI - Schatztruhe)[!][Aug 2001].iso / Aminet / util / libs / DragnDrop14.lha / Dragndrop_demo.lha / DragnDrop / TestDragnDrop.p < prev    next >
Text File  |  1999-03-30  |  4KB  |  135 lines

  1.  
  2.     {* Include sys:coder/preass/Options.p *}
  3.     {* Include sys:coder/preass/Prozeduren.p *}
  4.  
  5.     {* String: Version="$VER: (C) CYBORG 1998-99"*}
  6.  
  7.     {* Array[Long]: Drops,141,419,295,472,0,0,0,0,0,0*}
  8.  
  9.     {* Array[Long]: Polygon1,22,13,141,13,82,70,81,70,22,13,0,0*}
  10.     {* Array[Long]: Polygon2,82,73,141,132,82,191,81,191,22,132,82,73,0,0*}
  11.     {* Array[Long]: Polygon3,22,254,81,195,82,195,141,254,22,254,0,0*}
  12.     {* Array[Long]: Polygon4,401,99,460,40,519,40,580,100,521,159,460,159,401,100,0,0*}
  13.     {* Array[Long]: Polygon5,28,447,138,418,138,474,28,447,0,0*}
  14.     {* Array[Long]: Polygon7,297,418,403,447,297,473,297,418,0,0*}
  15.     {* Array[Long]: Polygon8,228,134,634,374,602,475,518,459,158,226,228,134,0,0*}
  16.  
  17.     {* Include module:Display_IFF.p*}
  18.  
  19. Open_Window[Lokal,Lokal1]:
  20.     Window=OpenGuiWindowA(000,000,640,480,Lokal1,
  21.             #IDCMP_MOUSEMOVE!IDCMP_MOUSEBUTTONS!IDCMP_GADGETDOWN!IDCMP_GADGETUP!IDCMP_REFRESHWINDOW!IDCMP_MENUPICK!IDCMP_VANILLAKEY!IDCMP_RAWKEY!0,
  22.             #WFLG_BACKDROP!WFLG_BORDERLESS!WFLG_REPORTMOUSE!0,
  23.              Lokal,0)
  24.     Checkf Window,Open_Windowende
  25.     GUI=CreateGuiInfoA(Window,0)
  26.       CreateGUIMenuEntryA(gui,001,"Projekt",0)
  27.     CreateGUIMenuEntryA(gui,002,"Quit",
  28.             >Menu001Tags:GEM_Shortcut,MenuShorCut001MSC="q"|
  29.                 Tag_Done,0)
  30. Open_Windowende:
  31.     {* Return Window*}
  32.  
  33. Close_Window[Lokal]:
  34.     {* IncVar: Lokal*}
  35.     CloseGuiWindow(Lokal)
  36.     RTS
  37.  
  38. Open_Screen[Screenmode,Lokal1]:
  39.     {* IncVar: Screenmode,Lokal1,Lokal2,Lokal3*}
  40.     Screen=OpenGuiScreenA(Screenmode,8,Lokal1,
  41.                           >ScreenTags:SA_Font,TopazAttr|
  42.                                       SA_Left,0|SA_Top,0|SA_Behind,false|
  43.                                       SA_Width,640|SA_Height,480|
  44.                                       Tag_done,Null)
  45. .Ende:
  46.     {* Return Screen*}
  47.  
  48. even
  49. TopazAttr:
  50.     dc.l TopazName
  51.     dc.w 8
  52.     dc.b 0,0
  53. Topazname:
  54.     dc.b "topaz.font",0
  55.     blk.b 29,0
  56.  
  57. Close_Screen[Lokal]:
  58.     CloseGuiScreen(Lokal)
  59.     RTS
  60.  
  61. Haupt[]:
  62.     {* IncVar: TA_Result*}
  63.     WaitGuiMsg(Gui)
  64.     MsgClass=.l36(Gui)
  65.     MsgGadNbr=.w52(Gui)
  66.     MsgMenuNum=.w54(Gui)
  67.     MsgItemNum=.w56(Gui)
  68.     Imsg=.l32(Gui)
  69.     Mx=.w32(Imsg)
  70.     My=.w34(Imsg)
  71.     dx==mx-mxa
  72.     dy==my-mya
  73.     mxa==mx
  74.     mya==my
  75.     If MsgClass=#IDCMP_MOUSEMOVE and Dragstatus=1 --> .Delta
  76.     If MsgClass=#IDCMP_MOUSEBUTTONS --> .Dragdrop
  77.     If MsgClass##IDCMP_MENUPICK --> Haupt
  78.     RTS
  79. .DragDrop:
  80.     If DragStatus=1 --> .Drop
  81. .Drag:
  82.     If (TA_result=DND_TestPolygon(&Polygon1,mx,my))#0 --> .Dragfound
  83.     If (TA_result=DND_TestPolygon(&Polygon2,mx,my))#0 --> .Dragfound
  84.     If (TA_result=DND_TestPolygon(&Polygon3,mx,my))#0 --> .Dragfound
  85.     If (TA_result=DND_TestPolygon(&Polygon4,mx,my))#0 --> .Dragfound
  86.     If (TA_result=DND_TestPolygon(&Polygon5,mx,my))#0 --> .Dragfound
  87.     If (TA_result=DND_TestPolygon(&Polygon7,mx,my))#0 --> .Dragfound
  88.     If (TA_result=DND_TestPolygon(&Polygon8,mx,my))#0 --> .Dragfound Else Haupt
  89. .dragfound:
  90.     Dragstatus==1
  91.     Drag=DND_OpenPolygon(Rastport1,TA_Result,Screen1)
  92.     bra Haupt
  93. .Delta:
  94.     {* Flush *}
  95.     DND_MoveDrag(Drag,dx,dy)
  96.     bra Haupt
  97. .Drop:
  98.     {* Flush *}
  99.     Dragstatus==0
  100.     DND_CloseDrag(Drag)
  101.     DND_FreeResult(TA_Result)
  102.     Drag==0
  103.     If (TA_result=DND_TestArea(&Drops,mx,my))=0 --> Haupt
  104.     DND_FreeResult(Ta_result)
  105. .Dropfound:
  106.     GuiRequestA(Gui,"Drop!",#GER_Okkind,0)
  107.     bra Haupt
  108.  
  109. Hintergrundbild[Lokal]:
  110.     ScreenRastport=84(Screen1)
  111.     Viewport=44(Screen1)
  112.     Maxhoehe==480
  113.     DisplayIff(LOKAL,#Normal,Rastport1,00,0)
  114.     RTS
  115.  
  116. Start:
  117.     {* Incblock: Block,1024*}
  118.     IH=Input()
  119.     OH=Output()
  120.        If (Screen1=Open_Screen(#$39024,"Screen1"))#0  {
  121.            If (Window1=Open_Window(Screen1,"Window1"))#0  {
  122.                 Gui1==Gui
  123.                         Rastport1=.l50(Window1)
  124.                         HintergrundBild("dragndrop.iff")
  125. ;                        DND_Draw(Rastport1,&Drags,1)
  126. ;                        DND_DrawPolygon(Rastport1,&polygon,1)
  127.                         DrawGuiA(Gui1,0)
  128.                         Gui==Gui1
  129.                         Haupt()
  130.                         Close_Window(Window1)
  131.                                                          }
  132.                     Close_Screen(Screen1)
  133.                                                       }
  134.     RTS
  135.